# ============================================================
# * Copyright © hk. 2022-2025. All rights reserved.
# * File name: CMakeLists.txt
# * Author   : 苏木
# * Date     : 2025-05-22
# * Version  : 
# * Description: cmake version 3.16.3
# ============================================================
## https://cmake.com.cn/cmake/help/latest/guide/tutorial/index.html
## https://cmake.org/cmake/help/latest/

# 指定 CMake 的最低版本要求
# --------------------------------------------------
cmake_minimum_required(VERSION 3.10)


# 设置项目名称和使用的编程语言
# --------------------------------------------------
project(SPROJECT C)


# 指定可执行程序和源文件
# --------------------------------------------------
add_executable(app_demo.out main.c)


# file读取
# --------------------------------------------------
# file(READ <filename> <variable> [OFFSET <offset>] [LIMIT <max-in>] [HEX])
# 读取文件（filename）的内容保存到变量（variable）中
message(STATUS "==> ${CMAKE_VERSION} 读取文件")
file(READ file_path.txt file_contents)
string(REPLACE "\n" ";" line_list "${file_contents}") # 将内容按换行符分割成列表

# 遍历并打印每一行
foreach(line IN LISTS line_list)
    if(NOT line STREQUAL "")  # 过滤空行
        message(STATUS "[USER:TOP}Line: ${line}")
    endif()
endforeach()
message("")
